Integrate Google map in MS access 2010


This article explains how to integrate/embed Google map in MS access 2010 using VBA code. To implement this concept in Microsoft Access VBA knowledge is required.

This article is about to embeded google map using MS Access form. Firstly we have to select a blank form and from toolbar click on activeX controls option as shown in Fig 1.1

Use mouse wheel scrolling within text box in Access VBA Fig-1.1

Fig:-1.1

A small pop up will open and we have to select on "Microsoft web browser" option as shown in Fig 1.2

Use mouse wheel scrolling within text box in Access VBA Fig-1.2

Fig:-1.2

After the selection of "microsoft web browser" the form design view is look like Fig 1.3. TimerInterval Property of form. Then write VBA code for this form at the end of article.

Use mouse wheel scrolling within text box in Access VBA Fig-1.3

Fig:-1.3

Create new form and insert button on the form as shown in Fig 1.4. On "click" button event We have to giving path of address that we want to open.

Use mouse wheel scrolling within text box in Access VBA Fig-1.4

Fig:-1.4

Whenever we select "click" button on form2 then control will go to Form1. And It will show the google map of the giving address as shown in Fig 1.5

Use mouse wheel scrolling within text box in Access VBA Fig-1.5

Fig:-1.5

VBA code for Form1:-

Private Sub cmdClose_Click()
Me.TimerInterval = 1000
MyAssigned = False
Set objBrowser = Nothing
DoCmd.Hourglass False
DoCmd.Close acForm, "From1", acSaveNo
End Sub
Private Sub Form_Timer()
Dim objBrowser As Object
Set objBrowser = Me.WebBrowser0
If MyAssigned = False Then
DoCmd.Hourglass True
With Me.WebBrowser0
.Navigate MyGoogleMapURL
Do Until .ReadyState <> 3
DoEvents
Loop
DoEvents
Do Until .ReadyState = 4
DoEvents
Loop
DoEvents
MyAssigned = True
End With
DoCmd.Hourglass False
End If
End Sub

VBA code for Form2:-

Private Sub Command0_Click()
MyGoogleMapURL=" http://maps.google.com/maps?q=Chandigarh,+India&hl=en&ll=30.730032,
76.812973&spn=0.254979,0.486145&sll= 37.555465,-122.689819&sspn=0.940628,
2.993774&oq=chandigarh&hnear=Chandigarh,+India &t=m&z=11”
DoCmd.OpenForm "Form1", acNormal
End Sub

VBA code for Module:-

Option Compare Database
Public MyAssigned As Boolean
Public MyGoogleMapURL As String


DISCLAIMER

It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.


 

BUY SERVICES CONTACT